<admintpl file="header" />
</head>
<style>
input .danxuan{ width:14px; height:14px;float:left;}
span .text{ margin-right: 40px;}
.radio {margin-top: 5px;margin-left: 5px;margin-right: 20px; float: left;}
</style>
<body>
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li class="active"><a>创建小组</a></li>
        </ul>
        <form action="{:U('Usergroup/add_post')}" method="post" class="form-horizontal js-ajax-forms" enctype="multipart/form-data">
            <div class="row-fluid">
                <div class="span12">
                    <table class="table table-bordered">
                        <tr>
                            <th>名称</th>
                            <td>
                                <input type="text" name="name" required autocomplete="off" maxlength="16"/>创建后不可修改
                            </td>
                        </tr>
                        <tr>
                            <th>介绍</th>
                            <td>
                                <input type="text" name="explanation" required autocomplete="off" maxlength="64"/>
                            </td>
                        </tr>
                        <tr>
                            <th>所在省份</th>
                            <td>
								<select name="province">
									<option value="0" >请选择省份</option>
									<foreach name="province" item="vo">
										<option value="{$vo.code}" >{$vo.name}</option>
									</foreach>
						  		</select>选择后不可更改
                            </td>
                        </tr>
                        <tr>
                            <th>Logo</th>
                            <td><input type="file" name="logo" id="logofile" accept="image/*"/></td>
                        </tr>
                        <tr>
                            <th></th>
                        	<td><img src="" id="logoimg"></td>
                       </tr>
                    </table>
                </div>
            </div>
            <div class="form-actions">
                <button class="btn btn-primary js-ajax-submit" type="submit">创建</button>
                <a class="btn" onclick="javascript:history.go(-1);">返回</a>
            </div>
        </form>
    </div>
    <script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
    <script type="text/javascript">
	$("#logofile").change(function(){
		var objUrl = getObjectURL(this.files[0]) ;
		console.log("objUrl = "+objUrl) ;
		if (objUrl) {
			$("#logoimg").attr("src", objUrl) ;
		}
	}) ;
	function getObjectURL(file) {
		var url = null ;
		if (window.createObjectURL!=undefined) { // basic
			url = window.createObjectURL(file) ;
		} else if (window.URL!=undefined) { // mozilla(firefox)
			url = window.URL.createObjectURL(file) ;
		} else if (window.webkitURL!=undefined) { // webkit or chrome
			url = window.webkitURL.createObjectURL(file) ;
		}
		return url ;
	}
    </script>
</body>
</html>
